package com.uenpay.im.invokeitems.person;

import com.qiyunxin.android.http.net.HttpInvokeItem;
import com.uenpay.im.configuration.APIConfiguration;

import org.json.JSONObject;

/**
 *
 *  @author SL
 * @copyRight http://www.qiyunxin.com
 */
public class UpdatePwdInvokItem extends HttpInvokeItem {

	public class UpdatePwdInvokItemResult {
		public int status;
		public String msg;
		public long timeStamp;
	}

	public UpdatePwdInvokItemResult getOutput() {
		return (UpdatePwdInvokItemResult) GetResultObject();
	}

	public UpdatePwdInvokItem(String old_password, String new_password,
			String confirm_password) {
		String url = APIConfiguration.getBaseUrl()
				+ "Cust/Cust/updatePwd?oldpassword=" + old_password
				+ "&newpassword=" + new_password + "&passwordconfirm="
				+ confirm_password + "&" + APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) throws Exception {
		UpdatePwdInvokItemResult result = new UpdatePwdInvokItemResult();
		JSONObject json = new JSONObject(responseBody);
		result.status = json.optInt("status");
		result.msg = json.optString("msg");
		return result;
	}

}
